﻿namespace HRM.CORE.Machine
{
    using DevExpress.Utils;
    using DevExpress.XtraBars;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using APP.HELPER;
    using Common.Class; using APP.HELPER.Utils.Language; using Security.Security; using Dictionary.ERP;
    using HRM.CORE;
    using Extra;
    using Service;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms; using Common;
    using zkemkeeper;

    public class xucMachineItem : Common.xucBase
    {
        public CZKEMClass axCZKEM;
        private BarDockControl barDockControlBottom;
        private BarDockControl barDockControlLeft;
        private BarDockControl barDockControlRight;
        private BarDockControl barDockControlTop;
        private BarManager barManager1;
        private BarButtonItem bbiConnect;
        private BarButtonItem bbiDeleteAllData;
        private BarButtonItem bbiDisConnect;
        private BarButtonItem bbiProperty;
        private BarButtonItem bbiSignUp;
        private IContainer components;
        private DevExpress.Utils.ImageCollection imageCollection1;
        private LabelControl lbMachineName;
        private string m_IP;
        private bool m_IsConnected;
        private bool m_IsRegister;
        private string m_MachineCode;
        private string m_MachineName;
        private int m_MachineNumber;
        private int m_Password;
        private string m_Port;
        private Panel panel1;
        private PanelControl panelControl1;
        private PopupMenu ppMenu;
        private PictureEdit ptIcon;

        public event AddRowEventHandler AddRowEvent;

        public event ConnectCompleteEventHander ConnectComplete;

        public event ConnectErrorEventHander ConnectError;

        public event ConnectProcessEventHander ConnectProcess;

        public event DisConnectCompleteEventHander DisConnectComplete;

        public event DisConnectErrorEventHander DisConnectError;

        public event DisConnectProcessEventHander DisConnectProcess;

        public event OnTransactionEventHandler OnTransactionEvent;

        public xucMachineItem()
        {
            this.components = null;
            this.InitializeComponent();
            this.m_MachineCode = "";
            this.m_MachineName = "";
            this.m_IsConnected = false;
            this.m_IP = "";
            this.m_Port = "";
            this.m_MachineNumber = 1;
            this.m_Password = 0;
            this.RegisterLibrary();
            this.LoadInterface(true);
        }

        public xucMachineItem(string MachineCode, string MachineName, string IP, string Port, int Password)
        {
            this.components = null;
            this.InitializeComponent();
            this.m_MachineCode = MachineCode;
            this.m_MachineName = MachineName;
            this.m_IsConnected = false;
            this.m_IP = IP;
            this.m_Port = Port;
            this.m_MachineNumber = 1;
            this.m_Password = Password;
            this.RegisterLibrary();
            this.LoadInterface(true);
        }

        private void axCZKEM_OnAttTransaction(int EnrollNumber, int IsInValid, int AttState, int VerifyMethod, int Year, int Month, int Day, int Hour, int Minute, int Second)
        {
            System.DateTime date = Convert.ToDateTime(string.Concat(new object[] { Year, "/", Month, "/", Day })).Date;
            System.DateTime hour = Convert.ToDateTime(string.Concat(new object[] { Day, "/", Month, "/", Year, " ", Hour, ":", Minute, ":", Second }));
            new HRM_EMPLOYEE().GetByEnroll(EnrollNumber.ToString());
            this.RaiseOnTransactionEventHandler(EnrollNumber.ToString(), date, hour, AttState, this.m_MachineNumber);
        }

        private void bbiConnect_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.Connect();
        }

        private void bbiDeleteAllData_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!this.m_IsConnected)
            {
                XtraMessageBox.Show("Vui l\x00f2ng kết nối với thiết bị trước", "Th\x00f4ng B\x00e1o");
            }
            else
            {
                CODE code = new CODE();
                code.CheckLicense();
                code.Execute();
                if ((CODE.TypeSoft == 0) || (CODE.TypeSoft == 1))
                {
                    XtraMessageBox.Show("Vui l\x00f2ng nhập m\x00e3 đăng k\x00fd phần mềm để thực hiện chức năng n\x00e0y!", "Th\x00f4ng B\x00e1o");
                }
                else
                {
                    int dwErrorCode = 0;
                    this.axCZKEM.EnableDevice(this.m_MachineNumber, false);
                    if (XtraMessageBox.Show("Bạn c\x00f3 chắc x\x00f3a hết dữ liệu chấm c\x00f4ng trong thiết bị kh\x00f4ng ?", "Th\x00f4ng B\x00e1o", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (this.axCZKEM.ClearGLog(this.m_MachineNumber))
                        {
                            this.axCZKEM.RefreshData(this.m_MachineNumber);
                            XtraMessageBox.Show("Tất cả dữ liệu tr\x00ean m\x00e1y đ\x00e3 được x\x00f3a!", "Th\x00f4ng B\x00e1o");
                        }
                        else
                        {
                            this.axCZKEM.GetLastError(ref dwErrorCode);
                            XtraMessageBox.Show("Lỗi thực thi,ErrorCode=" + dwErrorCode.ToString(), "Th\x00f4ng B\x00e1o");
                        }
                        this.axCZKEM.EnableDevice(this.m_MachineNumber, true);
                    }
                }
            }
        }

        private void bbiDisConnect_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.DisConnect();
        }

        private void bbiProperty_ItemClick(object sender, ItemClickEventArgs e)
        {
            xfmMachineInformation information = new xfmMachineInformation(this.axCZKEM, this.m_MachineName, this.m_IP, this.m_MachineNumber);
            information.RestartDevice += s => this.DisConnect();
            information.PowerOffDevice += s => this.DisConnect();
            information.ShowDialog();
        }

        private void bbiSignUp_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!this.m_IsConnected)
            {
                XtraMessageBox.Show("Vui l\x00f2ng kết nối với thiết bị trước", "Th\x00f4ng B\x00e1o");
            }
            else
            {
                new xfmReg(this.axCZKEM).ShowDialog();
            }
        }

        public void Connect()
        {
            if (!this.m_IsRegister)
            {
                XtraMessageBox.Show("Chưa đăng k\x00fd thư viện chấm c\x00f4ng!", "Th\x00f4ng B\x00e1o");
            }
            else if ((this.m_IP == "") || (this.m_Port == ""))
            {
                XtraMessageBox.Show("Vui l\x00f2ng chọn thiết bị kết nối hoặc kiểm tra lại c\x00e1c th\x00f4ng số của thiết bị!", "Lỗi");
            }
            else
            {
                try
                {
                    base.SetWaitDialogCaption("Đang kết nối đến m\x00e1y..." + this.m_IP);
                    if (this.m_Password != 0)
                    {
                        this.axCZKEM.SetCommPassword(this.m_Password);
                    }
                    this.m_IsConnected = this.axCZKEM.Connect_Net(this.m_IP, int.Parse(this.m_Port));
                }
                catch
                {
                    this.m_IsConnected = false;
                }
                if (this.m_IsConnected)
                {
                    this.DoHide();
                    this.RaiseConnectCompleteEventHander();
                    if (this.axCZKEM.RegEvent(this.m_MachineNumber, 0xffff))
                    {
                        this.axCZKEM.OnAttTransaction += new _IZKEMEvents_OnAttTransactionEventHandler(this.axCZKEM_OnAttTransaction);
                    }
                    else
                    {
                        XtraMessageBox.Show("Lỗi kết nối thời gian thực với thiết bị!", "Th\x00f4ng B\x00e1o");
                    }
                    this.axCZKEM.EnableDevice(this.m_MachineNumber, true);
                }
                else
                {
                    this.DoHide();
                    this.RaiseConnectErrorEventHander("Kh\x00f4ng thể kết nối với " + this.m_MachineName + " (địa chỉ ip: " + this.m_IP + ")");
                }
                this.LoadInterface(false);
            }
        }

        private void Control_MouseEnter(object sender, EventArgs e)
        {
        }

        private void Control_MouseLeave(object sender, EventArgs e)
        {
        }

        public int Count()
        {
            int dwValue = 0;
            this.axCZKEM.EnableDevice(this.m_MachineNumber, false);
            if (this.axCZKEM.GetDeviceStatus(this.m_MachineNumber, 6, ref dwValue))
            {
                return dwValue;
            }
            return dwValue;
        }

        public void DisConnect()
        {
            try
            {
                this.axCZKEM.Disconnect();
                this.m_IsConnected = false;
            }
            catch
            {
                this.m_IsConnected = false;
            }
            this.LoadInterface(false);
            this.RaiseDisConnectCompleteEventHander();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public void GetGeneralLogData(bool FilterByDay, System.DateTime FromDate, System.DateTime ToDate)
        {
            int dwTMachineNumber = 0;
            int dwEnrollNumber = 0;
            string str = "";
            int dwEMachineNumber = 0;
            int dwVerifyMode = 0;
            int dwInOutMode = 0;
            int dwYear = 0;
            int dwMonth = 0;
            int dwDay = 0;
            int dwHour = 0;
            int dwMinute = 0;
            int dwSecond = 0;
            int dwWorkCode = 0;
            int num14 = 0;
            this.Cursor = Cursors.WaitCursor;
            Options.SetWaitDialogCaption("Đang đọc dữ liệu từ " + this.m_MachineName);
            Options.SetWaitDialogCaption("Đang đọc dữ liệu từ " + this.m_MachineName);
            if (this.axCZKEM.ReadGeneralLogData(this.m_MachineNumber))
            {
                System.DateTime time;
                System.DateTime time2;
                Options.SetWaitDialogCaption("Đang tải dữ liệu từ " + this.m_MachineName);
                if (!this.axCZKEM.IsTFTMachine(this.m_MachineNumber))
                {
                    while (this.axCZKEM.GetGeneralLogData(this.m_MachineNumber, ref dwTMachineNumber, ref dwEnrollNumber, ref dwEMachineNumber, ref dwVerifyMode, ref dwInOutMode, ref dwYear, ref dwMonth, ref dwDay, ref dwHour, ref dwMinute))
                    {
                        num14++;
                        time = Convert.ToDateTime(string.Concat(new object[] { dwYear, "/", dwMonth, "/", dwDay }));
                        time2 = Convert.ToDateTime(string.Concat(new object[] { dwYear, "/", dwMonth, "/", dwDay, " ", dwHour, ":", dwMinute }));
                        if (FilterByDay)
                        {
                            if ((time >= FromDate.Date) && (time <= ToDate.Date))
                            {
                                this.RaiseAddRowEventHandler(dwEnrollNumber.ToString(), time, time2, dwInOutMode, this.m_MachineNumber);
                            }
                        }
                        else
                        {
                            this.RaiseAddRowEventHandler(dwEnrollNumber.ToString(), time, time2, dwInOutMode, this.m_MachineNumber);
                        }
                    }
                }
                else
                {
                    while (this.axCZKEM.SSR_GetGeneralLogData(this.m_MachineNumber, out str, out dwVerifyMode, out dwInOutMode, out dwYear, out dwMonth, out dwDay, out dwHour, out dwMinute, out dwSecond, ref dwWorkCode))
                    {
                        num14++;
                        time = Convert.ToDateTime(string.Concat(new object[] { dwYear, "/", dwMonth, "/", dwDay }));
                        time2 = Convert.ToDateTime(string.Concat(new object[] { dwYear, "/", dwMonth, "/", dwDay, " ", dwHour, ":", dwMinute }));
                        if (FilterByDay)
                        {
                            if ((time >= FromDate.Date) && (time <= ToDate.Date))
                            {
                                this.RaiseAddRowEventHandler(str, time, time2, dwInOutMode, this.m_MachineNumber);
                            }
                        }
                        else
                        {
                            this.RaiseAddRowEventHandler(str, time, time2, dwInOutMode, this.m_MachineNumber);
                        }
                    }
                }
            }
            this.axCZKEM.EnableDevice(this.m_MachineNumber, true);
            Options.HideDialog();
            this.Cursor = Cursors.Default;
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(xucMachineItem));
            this.lbMachineName = new LabelControl();
            this.panel1 = new Panel();
            this.ptIcon = new PictureEdit();
            this.imageCollection1 = new DevExpress.Utils.ImageCollection(this.components);
            this.barManager1 = new BarManager(this.components);
            this.barDockControlTop = new BarDockControl();
            this.barDockControlBottom = new BarDockControl();
            this.barDockControlLeft = new BarDockControl();
            this.barDockControlRight = new BarDockControl();
            this.bbiConnect = new BarButtonItem();
            this.bbiDisConnect = new BarButtonItem();
            this.bbiDeleteAllData = new BarButtonItem();
            this.bbiSignUp = new BarButtonItem();
            this.bbiProperty = new BarButtonItem();
            this.ppMenu = new PopupMenu(this.components);
            this.panelControl1 = new PanelControl();
            this.panel1.SuspendLayout();
            this.ptIcon.Properties.BeginInit();
            this.imageCollection1.BeginInit();
            this.barManager1.BeginInit();
            this.ppMenu.BeginInit();
            this.panelControl1.BeginInit();
            this.panelControl1.SuspendLayout();
            base.SuspendLayout();
            this.lbMachineName.AllowHtmlString = true;
            this.lbMachineName.Appearance.BackColor = Color.Transparent;
            this.lbMachineName.Appearance.ForeColor = Color.Black;
            this.lbMachineName.Appearance.Options.UseBackColor = true;
            this.lbMachineName.Appearance.Options.UseForeColor = true;
            this.lbMachineName.AutoSizeMode = LabelAutoSizeMode.None;
            this.lbMachineName.Dock = DockStyle.Fill;
            this.lbMachineName.Location = new Point(0x2c, 2);
            this.lbMachineName.Name = "lbMachineName";
            this.lbMachineName.Padding = new Padding(4, 0, 0, 0);
            this.lbMachineName.Size = new Size(0xbc, 0x22);
            this.lbMachineName.TabIndex = 0;
            this.lbMachineName.Text = "labelControl1";
            this.lbMachineName.MouseLeave += new EventHandler(this.Control_MouseLeave);
            this.lbMachineName.Click += new EventHandler(this.xucMachineItem_Click);
            this.lbMachineName.MouseEnter += new EventHandler(this.Control_MouseEnter);
            this.panel1.Controls.Add(this.ptIcon);
            this.panel1.Dock = DockStyle.Left;
            this.panel1.Location = new Point(2, 2);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x2a, 0x22);
            this.panel1.TabIndex = 1;
            this.panel1.MouseLeave += new EventHandler(this.Control_MouseLeave);
            this.panel1.Click += new EventHandler(this.xucMachineItem_Click);
            this.panel1.MouseEnter += new EventHandler(this.Control_MouseEnter);
            this.ptIcon.Dock = DockStyle.Fill;
            this.ptIcon.EditValue = MsgResc.U160;
            this.ptIcon.Location = new Point(0, 0);
            this.ptIcon.Name = "ptIcon";
            this.ptIcon.Properties.Appearance.BackColor = Color.Transparent;
            this.ptIcon.Properties.Appearance.Options.UseBackColor = true;
            this.ptIcon.Properties.NullText = " ";
            this.ptIcon.Size = new Size(0x2a, 0x22);
            this.ptIcon.TabIndex = 0;
            this.ptIcon.MouseEnter += new EventHandler(this.Control_MouseEnter);
            this.ptIcon.MouseLeave += new EventHandler(this.Control_MouseLeave);
            this.ptIcon.Click += new EventHandler(this.xucMachineItem_Click);
            this.imageCollection1.ImageStream = (ImageCollectionStreamer) manager.GetObject("imageCollection1.ImageStream");
            this.imageCollection1.Images.SetKeyName(0, "U160.png");
            this.barManager1.DockControls.Add(this.barDockControlTop);
            this.barManager1.DockControls.Add(this.barDockControlBottom);
            this.barManager1.DockControls.Add(this.barDockControlLeft);
            this.barManager1.DockControls.Add(this.barDockControlRight);
            this.barManager1.Form = this;
            this.barManager1.Items.AddRange(new BarItem[] { this.bbiConnect, this.bbiDisConnect, this.bbiDeleteAllData, this.bbiSignUp, this.bbiProperty });
            this.barManager1.MaxItemId = 5;
            this.bbiConnect.Caption = "Kết Nối";
            this.bbiConnect.Id = 0;
            this.bbiConnect.Name = "bbiConnect";
            this.bbiConnect.ItemClick += new ItemClickEventHandler(this.bbiConnect_ItemClick);
            this.bbiDisConnect.Caption = "Ngắt Kết Nối";
            this.bbiDisConnect.Id = 1;
            this.bbiDisConnect.Name = "bbiDisConnect";
            this.bbiDisConnect.ItemClick += new ItemClickEventHandler(this.bbiDisConnect_ItemClick);
            this.bbiDeleteAllData.Caption = "X\x00f3a Tất Cả Dữ Liệu Trong M\x00e1y";
            this.bbiDeleteAllData.Id = 2;
            this.bbiDeleteAllData.Name = "bbiDeleteAllData";
            this.bbiDeleteAllData.ItemClick += new ItemClickEventHandler(this.bbiDeleteAllData_ItemClick);
            this.bbiSignUp.Caption = "Đăng K\x00fd Dấu V\x00e2n Tay";
            this.bbiSignUp.Id = 3;
            this.bbiSignUp.Name = "bbiSignUp";
            this.bbiSignUp.ItemClick += new ItemClickEventHandler(this.bbiSignUp_ItemClick);
            this.bbiProperty.Caption = "Th\x00f4ng Tin Thiết Bị";
            this.bbiProperty.Id = 4;
            this.bbiProperty.Name = "bbiProperty";
            this.bbiProperty.ItemClick += new ItemClickEventHandler(this.bbiProperty_ItemClick);
            this.ppMenu.LinksPersistInfo.AddRange(new LinkPersistInfo[] { new LinkPersistInfo(this.bbiConnect), new LinkPersistInfo(this.bbiDisConnect), new LinkPersistInfo(this.bbiDeleteAllData, true), new LinkPersistInfo(this.bbiSignUp), new LinkPersistInfo(this.bbiProperty, true) });
            this.ppMenu.Manager = this.barManager1;
            this.ppMenu.Name = "ppMenu";
            this.panelControl1.Appearance.BackColor = Color.Transparent;
            this.panelControl1.Appearance.Options.UseBackColor = true;
            this.panelControl1.BorderStyle = BorderStyles.UltraFlat;
            this.panelControl1.Controls.Add(this.lbMachineName);
            this.panelControl1.Controls.Add(this.panel1);
            this.panelControl1.Dock = DockStyle.Fill;
            this.panelControl1.Location = new Point(0, 0);
            this.panelControl1.Name = "panelControl1";
            this.panelControl1.Size = new Size(0xea, 0x26);
            this.panelControl1.TabIndex = 4;
            this.panelControl1.MouseLeave += new EventHandler(this.panelControl1_MouseLeave);
            this.panelControl1.MouseEnter += new EventHandler(this.panelControl1_MouseEnter);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.panelControl1);
            base.Controls.Add(this.barDockControlLeft);
            base.Controls.Add(this.barDockControlRight);
            base.Controls.Add(this.barDockControlBottom);
            base.Controls.Add(this.barDockControlTop);
            base.Name = "xucMachineItem";
            base.Size = new Size(0xea, 0x26);
            base.MouseLeave += new EventHandler(this.xucMachineItem_MouseLeave);
            base.MouseEnter += new EventHandler(this.xucMachineItem_MouseEnter);
            base.Click += new EventHandler(this.xucMachineItem_Click);
            this.panel1.ResumeLayout(false);
            this.ptIcon.Properties.EndInit();
            this.imageCollection1.EndInit();
            this.barManager1.EndInit();
            this.ppMenu.EndInit();
            this.panelControl1.EndInit();
            this.panelControl1.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        public void LoadInterface(bool IsInit)
        {
            if (this.m_IsConnected)
            {
                this.bbiConnect.Enabled = false;
                this.bbiDisConnect.Enabled = true;
                this.bbiDeleteAllData.Enabled = true;
                this.bbiSignUp.Enabled = true;
                this.bbiProperty.Enabled = true;
                this.lbMachineName.ForeColor = Color.Green;
                this.lbMachineName.Text = "<b>" + this.m_MachineName + " (Đ\x00e3 kết nối)</b>" + Environment.NewLine + this.m_IP + "/" + this.m_Port;
                this.lbMachineName.Refresh();
                this.ptIcon.BackColor = Color.GreenYellow;
                this.ptIcon.Refresh();
            }
            else
            {
                this.bbiConnect.Enabled = true;
                this.bbiDisConnect.Enabled = false;
                this.bbiDeleteAllData.Enabled = false;
                this.bbiSignUp.Enabled = false;
                this.bbiProperty.Enabled = false;
                if (IsInit)
                {
                    this.lbMachineName.Text = "<b>" + this.m_MachineName + " (Chưa kết nối)</b>" + Environment.NewLine + this.m_IP + "/" + this.m_Port;
                }
                else
                {
                    this.lbMachineName.Text = "<b>" + this.m_MachineName + " (Đ\x00e3 ngắt kết nối)</b>" + Environment.NewLine + this.m_IP + "/" + this.m_Port;
                }
                this.lbMachineName.ForeColor = Color.Red;
                this.lbMachineName.Refresh();
                this.ptIcon.BackColor = Color.MistyRose;
                this.ptIcon.Refresh();
            }
        }

        private void panelControl1_MouseEnter(object sender, EventArgs e)
        {
        }

        private void panelControl1_MouseLeave(object sender, EventArgs e)
        {
        }

        private void RaiseAddRowEventHandler(string EnrollNumber, System.DateTime Date, System.DateTime Hour, int StateInOut, int MachineID)
        {
            HRM_EMPLOYEE hrm_employee = new HRM_EMPLOYEE();
            hrm_employee.GetByEnroll(EnrollNumber.ToString());
            if (this.AddRowEvent != null)
            {
                this.AddRowEvent(this, EnrollNumber, hrm_employee.EmployeeCode, hrm_employee.FirstName + " " + hrm_employee.LastName, Date, Hour, StateInOut, MachineID);
            }
        }

        private void RaiseConnectCompleteEventHander()
        {
            if (this.ConnectComplete != null)
            {
                this.ConnectComplete(this);
            }
        }

        private void RaiseConnectErrorEventHander(string Message)
        {
            if (this.ConnectError != null)
            {
                this.ConnectError(this, Message);
            }
        }

        private void RaiseConnectProcessEventHander(string Message)
        {
            if (this.ConnectProcess != null)
            {
                this.ConnectProcess(this, Message);
            }
        }

        private void RaiseDisConnectCompleteEventHander()
        {
            if (this.DisConnectComplete != null)
            {
                this.DisConnectComplete(this);
            }
        }

        private void RaiseDisConnectErrorEventHander(string Message)
        {
            if (this.DisConnectError != null)
            {
                this.DisConnectError(this, Message);
            }
        }

        private void RaiseDisConnectProcessEventHander(string Message)
        {
            if (this.DisConnectProcess != null)
            {
                this.DisConnectProcess(this, Message);
            }
        }

        private void RaiseOnTransactionEventHandler(string EnrollNumber, System.DateTime Date, System.DateTime Hour, int StateInOut, int MachineID)
        {
            HRM_EMPLOYEE hrm_employee = new HRM_EMPLOYEE();
            hrm_employee.GetByEnroll(EnrollNumber.ToString());
            if (this.OnTransactionEvent != null)
            {
                this.OnTransactionEvent(this, EnrollNumber, hrm_employee.EmployeeCode, hrm_employee.FirstName + " " + hrm_employee.LastName, Date, Hour, StateInOut, MachineID);
            }
        }

        private void RegisterLibrary()
        {
            this.m_IsRegister = false;
            try
            {
                this.axCZKEM = new CZKEMClass();
                this.m_IsRegister = true;
            }
            catch
            {
                this.m_IsRegister = false;
            }
        }

        private void xucMachineItem_Click(object sender, EventArgs e)
        {
            this.ppMenu.ShowPopup(Control.MousePosition);
        }

        private void xucMachineItem_MouseEnter(object sender, EventArgs e)
        {
        }

        private void xucMachineItem_MouseLeave(object sender, EventArgs e)
        {
        }

        public string IP
        {
            get
            {
                return this.m_IP;
            }
            set
            {
                this.m_IP = value;
            }
        }

        public bool IsConnected
        {
            get
            {
                return this.m_IsConnected;
            }
            set
            {
                this.m_IsConnected = value;
            }
        }

        public string MachineCode
        {
            get
            {
                return this.m_MachineCode;
            }
            set
            {
                this.m_MachineCode = value;
            }
        }

        public string MachineName
        {
            get
            {
                return this.m_MachineName;
            }
            set
            {
                this.m_MachineName = value;
            }
        }

        public int MachineNumber
        {
            get
            {
                return this.m_MachineNumber;
            }
            set
            {
                this.m_MachineNumber = this.MachineNumber;
            }
        }

        public int Password
        {
            get
            {
                return this.m_Password;
            }
            set
            {
                this.m_Password = value;
            }
        }

        public string Port
        {
            get
            {
                return this.m_Port;
            }
            set
            {
                this.m_Port = value;
            }
        }

        public delegate void AddRowEventHandler(object sender, string EnrollNumber, string EmployeeCode, string EmployeeName, System.DateTime Date, System.DateTime Hour, int StateInOut, int MachineID);

        public delegate void ConnectCompleteEventHander(object sender);

        public delegate void ConnectErrorEventHander(object sender, string Message);

        public delegate void ConnectProcessEventHander(object sender, string Message);

        public delegate void DisConnectCompleteEventHander(object sender);

        public delegate void DisConnectErrorEventHander(object sender, string Message);

        public delegate void DisConnectProcessEventHander(object sender, string Message);

        public delegate void OnTransactionEventHandler(object sender, string EnrollNumber, string EmployeeCode, string EmployeeName, System.DateTime Date, System.DateTime Hour, int StateInOut, int MachineID);
    }
}

